<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Admin/classes/PhpFox_ComponentSiteShutdown.class.php, $Author:  $ */



/** Component Site Shutdown
 *
 *
 *
 * @version $Id: PhpFox_ComponentSiteShutdown.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 * @package module.admin
 */
class PhpFox_Mod_Admin_ComponentSiteShutdown extends BaseComponent
{
    /** Process
     */
    function process()
    {
        $oSrvAdmin = $this->_oModule->getService('Admin');

        $oTpl = &$this->_oModule->getTemplate();
        $oReq = &App::getRequest();
        $oUrl = &App::getUrl();
        $oDb =& Database::get();

		if ( $oReq->get('go') )
		{
			$aItem = $oReq->getArray('val');
			$oSrvAdmin->saveSetting('site_shutdown', $aItem['off']);
			$oSrvAdmin->saveSetting('shutdown_header', $aItem['header']);
			$oSrvAdmin->saveSetting('allow_staff_view_shutdowned', $aItem['allow_staff']);
			$oSrvAdmin->saveSetting('offline_messages', $aItem['text']);
			App::deleteSetting();
			App::gotoUrl('admin.config.shutdown', array(), App::format('Mod_Admin.system_updated'), false);
		}
		
		$sMessage = $oDb->getField("SELECT val FROM " . App::getT('sys_sett') . " WHERE code = 'offline_messages'");		
		
        $oTpl->assignSrc(array(
            'bIsOff'      => App::getParam('site_shutdown'),
            'bAllowStaff' => App::getParam('allow_staff_view_shutdowned'),
            'sMessage' => $sMessage,
            'aOptions' => $oSrvAdmin->getOptions(),
        ));

        return $oTpl->fetch('SiteShutdown.html');
    }
}
?>